From 06f28af80ff57ae42f3b3a951d33e8d43e08352c Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Aug 2020 16:01:40 +0800 Subject: [PATCH] gdksurface-win32.c: Fix Aerosnap computation Don't get the default display when we compute the Aerosnap region, but instead get it from the underlying GdkSurface that we are using for the computation. Also, don't unref the monitors that we obtain from the display in the wrong place, which was why we had crashes whenever we triggered AeroSnap code (and we are actually not supposed to do that as they are owned by the GdkDisplay that is owned by the GdkSurface we are using), and this will eliminate lots of criticals that are spewed as a result. --- gdk/win32/gdksurface-win32.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index fc52a82a5a..ca8b765113 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -1979,7 +1979,7 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context) int i; #endif - display = gdk_display_get_default (); + display = gdk_surface_get_display (context->window); monitors = gdk_display_get_monitors (display); #define _M_UP 0 @@ -1999,7 +1999,6 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context) GdkMonitor *monitor; monitor = g_list_model_get_item (monitors, monitor_idx); - g_object_unref (monitors); gdk_win32_monitor_get_workarea (monitor, &wa); gdk_monitor_get_geometry (monitor, &geometry); @@ -3428,8 +3427,8 @@ setup_drag_move_resize_context (GdkSurface *window, GdkSurfaceEdge edge, GdkDevice *device, int button, - int x, - int y, + double x, + double y, guint32 timestamp) { RECT rect; -- 2.30.2